package edu.cmu.cs.webapp.ioms.ui.wizards.product;

import org.eclipse.jface.wizard.Wizard;

import edu.cmu.cs.webapp.ioms.models.Client;
import edu.cmu.cs.webapp.ioms.models.OrderStatus;
import edu.cmu.cs.webapp.ioms.models.Product;
import edu.cmu.cs.webapp.ioms.models.impl.IOMSFactoryImpl;

public class ProductWizard extends Wizard {
	
	private ProductMainWizardPage _generalPage;
//	private IngredientWizardPage _clientPage;
	private boolean _isUpdate;
	private Product _model;


	public ProductWizard(boolean update, Product model) {
		_isUpdate = update;
		this._model= model;
		
		
	}

	public void addPages(){
		_generalPage = new ProductMainWizardPage("Product information management Page");
		
		addPage(_generalPage);
		
	}
	
	@Override
	public boolean performFinish() {
		if (_model == null) {
			_model = IOMSFactoryImpl.eINSTANCE.createProduct();
		}
		_model.setProd_name(this._generalPage.get_productName());
		_model.setPrice(this._generalPage.get_price());
		_model.setProd_description(this._generalPage.get_description());
		return true;
	}

	

	public boolean isUpdate() {
		return _isUpdate;
	}

	public Product getModel() {
		return this._model;
	}

}
